{meta_html js $j_basepath.'design/back/js/jquery.ui.core.js'}
{meta_html js $j_basepath.'design/back/js/jquery.ui.widget.js'}
{meta_html js $j_basepath.'design/back/js/jquery.ui.mouse.js'}
{meta_html js $j_basepath.'design/back/js/jquery.ui.sortable.js'}

 <p><a style="margin-right:68px;" href="{jurl 'essais~BoFiches:index', array('iTypeId'=>2)}" class="bt_green"><span class="bt_green_lft"></span><strong>Retour à la liste</strong><span class="bt_green_r"></span></a></p>
                <p style="width:100%;clear:both;"><strong><H1>GAMME</H1></strong></p>

<p style="width:100%;clear:both;"><h1>{$essai->marque_libelle}, Ancienne gamme</h1></p>
<div id="gammeMenu">
    <ul>
        <li><a class="c1" href="{jurl 'essais~BoGamme:index', array('iId'=>$iId), false}">Chapeau</a></li>
        <li><a class="c1" href="{jurl 'essais~BoGamme:chapitre', array('iId'=>$iId,'type'=>1,'iTypeId'=>2), false}">Chapitres</a>
            <ul id="sortablechapitre">
			{foreach $chapitre as $item}
                <li class="chap" title="Glisser pour ré ordonner" id="tiChapitreIds_{$item->chap_id}"  class="ui-state-default"><label><a class="c2" href="{jurl 'essais~BoGamme:chapitre', array('chap_name_id'=>$item->chap_name_id,'iId'=>$item->ess_id,'type'=>1, 'iTypeId'=>2), false}">{$item->name}</a></label><a href="{jurl 'essais~BoGamme:supprChapitre', array('chapId'=>$item->chap_id, 'essaiId'=>$iId)}" class="ask" style="float:right;margin-right:16px;"><img src="{$j_basepath}design/back/img/user_logout.png" alt=""></a>
				{if sizeof($item->img)}
                    <ul>
					{foreach $item->img as $imgItem}
                        <li><a href="javascript:void(0)" onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'" id="{$imgItem}" class="img-pop">{$imgItem|basename}</a></li>  
					{/foreach}
                    </ul>
				{/if}
                </li>
			{/foreach}

            </ul>
        </li>	
        <li>
            <a class="c1" href="{jurl 'essais~BoGamme:modele', array('iId'=>$iId), false}">Modèles</a>
            {if sizeof ($modele)}
            <ul id="sortable">
			{foreach $modele as $item}
                <li title="Glisser pour ré ordonner" id="tiMarqueIds_{$item->chap_modele}" class="ui-state-default" style="background-position:3px 8px;">
                    <label>
                        <a class="c2" href="{jurl 'essais~BoGamme:modele', array('idGammeModele'=>$item->chap_modele, 'iId'=>$iId), false}">
                            <strong>{if $item->modele1}{$item->modele1}{assign $titleToPass = $item->modele1}{else}{$item->modele2}{assign $titleToPass = $item->modele2}{/if}</strong>
                        </a>
                        {if sizeof($item->image)}
                            <ul>
                                {assign $relativePath = PATH_ESSAI_IMG}
                                {assign $gm = $item->withoutConst}

                                {foreach $item->image as $k=>$itemImage}
                                    {if $gm[$k]}
                                        {assign $currentPath = $itemImage}
                                    {else}
                                        {assign $currentPath = $relativePath . $itemImage}
                                    {/if}
                                <li style="background-image:none;width:210px;">
                                    <a href="javascript:void(0)" onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'" id="{$currentPath}" class="img-pop">{$itemImage|basename}</a>
                                </li>
                                {/foreach}
                            </ul>
                        {/if}
                             <ul>
                                 {foreach $item->version as $itemVersion}
                                            <li style="background-image:none;width:210px;"> <a href="{jurl 'essais~BoModele:chapitre', array('iId'=>$item->ess_id,'chap_name_id'=>$itemVersion->version_name_id,'type'=>2,'iTypeId'=>2), false}">{$itemVersion->version_name} </li>
                                 {/foreach}
                                 <li style="background-image:none;width:210px;text-decoration:underline;list-style-type:none;"><a href="{jurl 'essais~BoModele:chapitre', array('iId'=>$iId,'idGammeModele'=>$item->chap_modele,'type'=>2,'iTypeId'=>2, 'ttl'=>$titleToPass)}"> Ajouter une version</a></li>
                                 <li style="background-image:none;width:210px;text-decoration:underline;list-style-type:none;"><a href="{jurl 'essais~BoModeleRappel:index', array('iId'=>$iId,'idGammeModele'=>$item->chap_modele,'iTypeId'=>1), false}"> Fiabilité</a> </li>
                             </ul>
                        <a href="{jurl 'essais~BoGamme:supprModele', array('chapId'=>$item->chap_id, 'essaiId'=>$iId)}" class="ask" style="float:right;margin-right:17px;"><img src="{$j_basepath}design/back/img/user_logout.png" alt=""></a>
                    </label>
				
                </li>
			{/foreach}
            </ul> <!--li does clear action-->
            
            {/if}
        </li>
        
    </ul>
</div>
<div id="light" class="white_content">
		<a class="close" href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Fermer</a>
			<div class="apercu1" id="apercu"><img src="" alt="" id="apecu-img"></div>
</div>
<div id="fade" class="black_overlay"></div>
{literal}
    <script>
        $(function() {
            $( "#sortable" ).sortable({ opacity: 0.6, cursor: 'move', update: function() {
                    var order = $(this).sortable("serialize") ;
                    $.post("{/literal}{jurl 'essais~BoGamme:reOrder', array(), false}{literal}", order);
                }
            });
            $( "#sortable" ).disableSelection();
        });

           $(function() {
            $( "#sortablechapitre" ).sortable({ opacity: 0.6, cursor: 'move', update: function() {
                    var order = $(this).sortable("serialize") ;
                    $.post("{/literal}{jurl 'essais~BoGamme:reOrderChapitre', array(), false}{literal}", order);
                }
            });
            $( "#sortablechapitre" ).disableSelection();
        });
  
    $(function(){
        $('.img-pop').click(function () {
            image = $(this).attr('id')
            $('#apecu-img').attr('src', image);
        });
    });
   </script>
   <style type="text/css">
    #sortable a {position:relative;left:15px;}
   </style>
{/literal}